package com.invengo.module_robot.ui.fragment.advertInfo;

import android.app.Application;

import androidx.annotation.NonNull;

import com.invengo.library_orionstar.ActionEvent;
import com.invengo.module_robot.data.repsitory.RobotRepsitory;

import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.binding.command.BindingCommand;

public class AdvertInfoViewModel extends BaseViewModel<RobotRepsitory> {
    public AdvertInfoViewModel(@NonNull Application application) {
        super(application);
    }

    /**
     * 下水总管
     */
    public BindingCommand launchMain = new BindingCommand(() -> {
        getUC().getFinishActivityEvent().call();
    });

    /**
     * 回去
     */
    public BindingCommand goBack = new BindingCommand(() -> {
        getUC().getOnBackPressedEvent().call();
    });

    /**
     * 动作命令
     */
    public BindingCommand<ActionEvent> actionCommand = new BindingCommand<>(action -> {
        Observable.just(action)
                .subscribeOn(AndroidSchedulers.mainThread())
                .subscribe(event -> {
                    switch (action.getEvent()) {

                        case ActionEvent.ACTION_DOWN:
//                            move2Next();
                            break;
                        case ActionEvent.ACTION_UP:
//                            move2Pre();
                            break;

                        case ActionEvent.ACTION_SEARCH:

                            break;
                    }
                });
    });
}
